<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	template="/layout/template.xhtml">

	<ui:define name="body">

		<h1>Base de Lições Aprendidas</h1>

		<h:form id="licaobuscar" styleClass="edit">

			<rich:simpleTogglePanel label="licao buscar Filter" switchType="ajax">

				<s:decorate template="/layout/display.xhtml">
					<ui:define name="label">Nome do Projeto</ui:define>
					<h:inputText id="projeto" value="#{licaoList.licao.projeto.nome}" />
				</s:decorate>

				<s:decorate template="/layout/display.xhtml">
					<ui:define name="label">Área Impactada</ui:define>
					<h:selectOneMenu id="areaimpactada"
						value="#{licaoList.licao.areaimpactada.id}">
						<f:selectItem itemLabel="Selecione ..." />
						<f:selectItems
							value="#{areaimpactadaList.areaimpactadaSelectItem}" />
					</h:selectOneMenu>
				</s:decorate>

				<s:decorate template="/layout/display.xhtml">
					<ui:define name="label">Impacto</ui:define>
					<h:selectOneMenu id="impacto"
						value="#{licaoList.licao.impactolicao.id}">
						<f:selectItem itemLabel="Selecione ..." />
						<f:selectItems value="#{impactolicaoList.impactolicaoSelectItem}" />
					</h:selectOneMenu>
				</s:decorate>

				<s:decorate template="/layout/display.xhtml">
					<ui:define name="label">Prioridade</ui:define>
					<h:selectOneMenu id="prioridade"
						value="#{licaoList.licao.prioridadelicao.id}">
						<f:selectItem itemLabel="Selecione ..." />
						<f:selectItems
							value="#{prioridadelicaoList.prioridadelicaoSelectItem}" />
					</h:selectOneMenu>
				</s:decorate>

				<s:decorate template="/layout/display.xhtml">
					<ui:define name="label">Título</ui:define>
					<h:inputText id="titulo" value="#{licaoList.licao.titulo}" />
				</s:decorate>


			</rich:simpleTogglePanel>

			<div class="actionButtons">
				<h:commandButton id="buscar" value="buscar"
					action="/view/licoes/LicaoList.xhtml" />
				<s:button id="reset" value="Reset" includePageParams="false" />
			</div>

		</h:form>

		<rich:panel>
			<f:facet name="header">Lições Aprendidas (#{empty licaoList.resultList ? 0 : (licaoList.paginated ? licaoList.resultCount : licaoList.resultList.size)})</f:facet>
			<div class="results" id="licaoList">

				<h:outputText value="The licao buscar returned no results."
					rendered="#{empty licaoList.resultList}" />

				<rich:dataTable id="licaoList" var="_licao"
					value="#{licaoList.resultList}"
					rendered="#{not empty licaoList.resultList}">
					<h:column>
						<f:facet name="header">
							<ui:include src="/layout/sort.xhtml">
								<ui:param name="entityList" value="#{licaoList}" />
								<ui:param name="propertyLabel" value="Id da Lição" />
								<ui:param name="propertyPath" value="licao.id" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_licao.id}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="/layout/sort.xhtml">
								<ui:param name="entityList" value="#{licaoList}" />
								<ui:param name="propertyLabel" value="Título" />
								<ui:param name="propertyPath" value="licao.titulo" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_licao.titulo}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="/layout/sort.xhtml">
								<ui:param name="entityList" value="#{licaoList}" />
								<ui:param name="propertyLabel" value="Areaimpactada" />
								<ui:param name="propertyPath" value="licao.areaimpactada.nome" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_licao.areaimpactada.nome}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="/layout/sort.xhtml">
								<ui:param name="entityList" value="#{licaoList}" />
								<ui:param name="propertyLabel" value="Projeto" />
								<ui:param name="propertyPath" value="licao.projeto.nome" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_licao.projeto.nome}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="/layout/sort.xhtml">
								<ui:param name="entityList" value="#{licaoList}" />
								<ui:param name="propertyLabel" value="Prioridade" />
								<ui:param name="propertyPath" value="licao.prioridadelicao.nome" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_licao.prioridadelicao.nome}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="/layout/sort.xhtml">
								<ui:param name="entityList" value="#{licaoList}" />
								<ui:param name="propertyLabel" value="Impacto" />
								<ui:param name="propertyPath" value="licao.impactolicao.nome" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_licao.impactolicao.nome}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="/layout/sort.xhtml">
								<ui:param name="entityList" value="#{licaoList}" />
								<ui:param name="propertyLabel" value="Descrição" />
								<ui:param name="propertyPath" value="licao.descricao" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_licao.descricao}" />
					</h:column>
					<rich:column styleClass="action">
						<f:facet name="header">Action</f:facet>
						<s:link view="/view/projeto.xhtml" value="Ver o Projeto"
							propagation="none" id="licaoViewId">
							<f:param name="projetoId" value="#{_licao.projeto.id}" />
						</s:link>
            #{' '}
            <s:link view="/view/licoes/LicaoEdit.xhtml" value="Editar"
							propagation="none" id="licaoEdit" rendered="#{empty from}">
							<f:param name="licaoId" value="#{_licao.id}" />
						</s:link>
					</rich:column>
				</rich:dataTable>

			</div>
		</rich:panel>

		<div class="tableControl">

			<s:link view="/view/licoes/LicaoList.xhtml"
				rendered="#{licaoList.previousExists}"
				value="#{messages.left}#{messages.left} First Page" id="firstPage">
				<f:param name="firstResult" value="0" />
			</s:link>

			<s:link view="/view/licoes/LicaoList.xhtml"
				rendered="#{licaoList.previousExists}"
				value="#{messages.left} Previous Page" id="previousPage">
				<f:param name="firstResult" value="#{licaoList.previousFirstResult}" />
			</s:link>

			<s:link view="/view/licoes/LicaoList.xhtml"
				rendered="#{licaoList.nextExists}"
				value="Next Page #{messages.right}" id="nextPage">
				<f:param name="firstResult" value="#{licaoList.nextFirstResult}" />
			</s:link>

			<s:link view="/view/licoes/LicaoList.xhtml"
				rendered="#{licaoList.nextExists}"
				value="Last Page #{messages.right}#{messages.right}" id="lastPage">
				<f:param name="firstResult" value="#{licaoList.lastFirstResult}" />
			</s:link>

		</div>

	</ui:define>

</ui:composition>
